<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;

class Dbtruncation extends Command
{
    /**
     * 截断数据表
     * The name and signature of the console command.
     * php artisan command:dbcutoff
     * @var string
     */
    protected $signature = 'command:dbcutoff';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $db_arr = [
            'order',
            'order_child',
            'order_audit_log',
            'order_logistics',
            'order_print',
            'order_second',
            'semi_finish_product',
            'finish_product'
        ];
        $other_arr = [
            'appendance_log',
            'balance_history',
            'check_log',
            'color',
            'customer',
            'employee',
            'exchange_goods',
            'file',
            'goods_shelf',
            'job_type',
            'management_card',
            'material',
            'material_specification',
            'material_type',
            'model',
            'model_field',
            'model_number',
            'model_number_specification',
            'product',
            'product_center',
            'product_color',
            'product_job_type',
            'product_model_number',
            'specification',
            'supplier',
            'warehouse',
            'warehouse_order',
            'warehouse_order_child',
            'warehouse_type'
        ];
        foreach($db_arr as $k=>$v){
            $this->info('截断表：'.$v);
            DB::table($v)->truncate();
        }
//        foreach($other_arr as $k=>$v){
//            $this->info('截断表：'.$v);
//            DB::table($v)->truncate();
//        }


    }
}
